@extends('layouts.home')
@extends('layouts.nav')
@extends('layouts.top')

@section('heading')
    <h3>
        课程设置
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">课程管理</a>
        </li>
        <li class="active"> 课程设置</li>
    </ul>
@endsection

@section('wrapper')
    @include('share.error')
                <div class="row">
                    <div class="col-sm-12">
                        <section class="panel">
                            <header class="panel-heading" style="overflow: hidden">
                                <span class="tools pull-right">
                                <form action="#" class="form-horizontal " style="float: left;width: 728px;">
                                    <select class="form-control" name="category_id" style="float:left;width:200px;margin-right: 30px;">
                                        <option value="">请选择分类</option>
                                        @foreach($categorys as $category)
                                            <option {{ request()->get('category_id') == $category->id ? 'selected' : '' }} value="{{ $category->id }}"> {{ $category->name }}</option>
                                        @endforeach
                                    </select>
                                    <select class="form-control" name="teacher_id" style="float:left;width:200px;margin-right: 30px;">
                                        <option value="">请选择教师</option>
                                        @foreach($teachers as $teacher)
                                            <option {{ request()->get('teacher_id') == $teacher->id ? 'selected' : '' }} value="{{ $teacher->id }}"> {{ $teacher->name }}</option>
                                        @endforeach
                                    </select>
                                    <div class="form-group row" style="overflow: hidden">
                                        <input type="text" class="form-control" value="{{ request()->get('title') }}" name="title" placeholder="请输入标题" style="float:left;margin-right: 10px;width: 200px"/>
                                        <div style="float: left">
                                            <button class="btn btn-success" style="float: right" type="submit">查询</button></div>
                                    </div>
                                </form>
                                    <button class="btn btn-info" style="float: left;margin-left: 30px;" onclick='location.href="{{ route('video.create') }}"'
                                    type="button">新增</button>

                                </span>
                            </header>
                            <div class="panel-body">
                                <table class="table  table-hover general-table">
                                    <thead>
                                    <tr>
                                        <th>封面</th>
                                        <th>标题</th>
                                        <th>金额</th>
                                        <th>分类</th>
                                        <th>教师</th>
                                        <th>状态</th>
                                        <th>创建时间</th>
                                        <th class="text-center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @foreach($videos as $video)
                                        <tr>
                                            <td><div style="width: 105px;height: 80px;"><img src="{{ asset($video->imaging->path) }}" style="height: 100%;" /></div></td>
                                            <td style="line-height:50px;">{{ $video->title }}</td>
                                            <td style="line-height:50px;">{{ $video->price }}</td>
                                            <td style="line-height:50px;">{{ $video->category->name }}</td>
                                            <td style="line-height:50px;">{{ $video->teacher->name }}</td>
                                            <td style="line-height:50px;">{{ $video->status == 1 ? '上架': '下架'}}</td>
                                            <td style="line-height:50px;">{{ $video->created_at }}</td>
                                            <td style="line-height:50px;" class="text-center">
                                                <button class="btn btn-success btn-xs" type="button" onclick='location.href="{{ route('video.edit', $video->id) }}"'>编辑</button>
                                            </td>
                                        </tr>
                                    @endforeach


                                    </tbody>
                                </table>
                                <div>
                                    <ul class="pagination pagination-lg">
                                        {{ $videos->links() }}
                                    </ul>
                                </div>
                            </div>

                        </section>
                    </div>
                </div>

@endsection